﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ServicesSessionLockCheck.aspx.cs"
	Inherits="ServicesSessionLockCheck" EnableSessionState="ReadOnly" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Concurrent Session Checker</title>
	<style>
		.square
		{
			width: 64px;
			height: 64px;
			border: 1px solid black;
			margin: 2px;
			display: inline-block;
		}
	</style>
	<script src='http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.1.js' type="text/javascript"></script>
</head>
<body>
	<form id="form1" runat="server">
	<asp:ScriptManager runat="server">
		<Services>
			<asp:ServiceReference Path="~/Services/ServiceRequiringSession.svc" />
		</Services>
	</asp:ScriptManager>
	<div id='s1' class='square'>
	</div>
	<div id='s2' class='square'>
	</div>
	<div id='s3' class='square'>
	</div>
	<div id='s4' class='square'>
	</div>
	<div id='s5' class='square'>
	</div>
	</form>
	<script type="text/javascript">
		$(document).ready(function () {
			var divs = $(".square");
			for (var i = 1; i <= divs.length; i++) {
				ServiceRequiringSession.GetTimesSessionUsed(createDisplayFunc(i));
			}
		});

		function createDisplayFunc(i) {
			return function (res) {
				$('#s' + i).html(res);
			}
		}

	</script>
</body>
</html>
